/* This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _EEPROM_HANDLER_
#define _EEPROM_HANDLER_

#define EEP_OK      (1)
#define EEP_NOK     (-1)

#define EEP_RELAY1_VAL_ADDR         (10)
#define EEP_RELAY2_VAL_ADDR         (11)
#define EEP_TEMP_WARN_VAL_ADDR      (12)
#define EEP_PHONE_NO_START_ADDR     (20)

#define EEPROM_PHONE_NO_END_CHAR    'E'

#define EEP_INVALID_DATA    (-50)
#define EEP_RELAY_OPEN      'O'
#define EEP_RELAY_CLOSED    'C'

struct s_eepData{
    int8_t relay1Value;
    int8_t relay2Value;
    int8_t tempWarningLevel;
    char masterPhoneNo[15];
};

void eepInitEep(struct s_eepData* pEepData);
int8_t eepGetStoredData(struct s_eepData* pEepData);
void eepSaveRelay1Value(int8_t value);
void eepSaveRelay2Value(int8_t value);
void eepSaveTempWarningLvl(int8_t level);
void eepSaveMasterPhoneNo(char* phnNo);

#endif
